<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="keywords" content="松滋人民政府,松滋市政府,市人民政府,市政府公众信息网" />
    <meta name="description" content="松滋市人民政府,松滋市人民政府,市人民政府，市政府公众信息网" />
    <meta name="SiteName" content="松滋市人民政府门户网站" />
    <meta name="SiteDomain" content="www.hbsz.gov.cn" />
    <meta name="SiteIDCode" content="4210870047" />
    <title>松滋市人民政府网</title>
    <link rel="shortcut icon" type="image/x-icon" href="http://static.hbsz.gov.cn:8788/css/favicon.ico" media=" screen"
        ignoreapd="true" />
    <link href="http://static.hbsz.gov.cn:8788/css/revision/sanitize.css" rel="stylesheet" type="text/css"
        ignoreapd="true" />
    <link href="http://static.hbsz.gov.cn:8788/css/revision/common.css" rel="stylesheet" type="text/css"
        ignoreapd="true" />
    <link href="http://static.hbsz.gov.cn:8788/css/revision/common.mobile.css" rel="stylesheet" type="text/css"
        ignoreapd="true" />
    <link href="http://static.hbsz.gov.cn:8788/css/revision/atomic.css" rel="stylesheet" type="text/css"
        ignoreapd="true" />
    <link href="http://static.hbsz.gov.cn:8788/css/revision/atomic.mobile.css" rel="stylesheet" type="text/css"
        ignoreapd="true" />
    <link rel="stylesheet" href="http://static.hbsz.gov.cn:8788/css/element.css" ignoreapd="true" />
    <link href="http://static.hbsz.gov.cn:8788/css/home.css" rel="stylesheet" type="text/css" ignoreapd="true" />
    <script type="text/javascript" src="http://static.hbsz.gov.cn:8788/script/jquery-3.3.1.min.js?v=20220507"
        ignoreapd="true"></script>
    <script type="text/javascript" src="http://static.hbsz.gov.cn:8788/script/axios.min.js" ignoreapd="true"></script>

    <style>
        body {
            background: url(http://static.hbsz.gov.cn:8788/images/di15.png) no-repeat;
        }

        .logo {
            height: 190px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }

        .section {
            width: 1200px;
            margin-left: auto;
            margin-right: auto;
        }

        .form-container {
            /* height: 1800px; */
            height: 2000px;
            background-color: white;
            box-shadow: 0px 3px 21px 0px rgba(0, 0, 0, 0.06);
            margin-bottom: 78px;
            padding: 20px;
        }

        .form-container .location {
            display: flex;
            align-items: center;
            height: 50px;
            border-bottom: #dedede 1px solid;
        }

        .el-form {
            padding: 30px 80px;
        }

        .el-form-item {
            margin-bottom: 30px;
        }

        .el-form-item__label {
            font-size: 18px;
            color: #666666;
        }

        /* textarea {
            height: 150px;
        } */

        .upload-container {
            width: 340px;
            height: 200px;
            border-radius: 4px;
            border: solid 1px #cbcbcb;
            padding: 10px;
        }

        .upload-container .el-upload {
            display: flex;
            color: #999999;
            width: 100%;
            justify-content: space-between;
            margin-bottom: 8px;
            font-size: 14px;
        }

        .upload-container .el-upload-list {
            height: 125px;
            border: solid 1px #cbcbcb;
            overflow: scroll;
            overflow-x: hidden;
            overflow-y: auto;
        }

        /* 图片框 */

        .el-upload-list {
            margin-top: 20px;
            height: 125px;
            border: solid 1px #cbcbcb;
            overflow: scroll;
            overflow-x: hidden;
            overflow-y: auto;
        }

        /* 图片框 */


        .search-warp {
            margin: 30px 50px;
            background-color: #dff5ff;
            color: #666666;
            font-family: MicrosoftYaHei;
            font-size: 18px;
            line-height: 36px;
            padding: 30px 110px;
        }

        p {
            margin: 0;
        }
    </style>
</head>

<body>
    <div class="logo section">
        <img src="http://static.hbsz.gov.cn:8788/images/title-yshj.png" ignoreapd="true" />
        <span style="margin-top: 10px;color: #fff;">（ 民意速办服务平台 ）</span>
    </div>

    <div class="section form-container">
        <div class="location">
            <img src="http://static.hbsz.gov.cn:8788/images/home.png" ignoreapd="true" style="margin-right: 8px" />
            <div aria-label="Breadcrumb" role="navigation" class="el-breadcrumb">
                <span class="el-breadcrumb__item"><span role="link" class="el-breadcrumb__inner"><a
                            href="http://www.hbsz.gov.cn/" class="nuxt-link-active">首页</a></span><span
                        role="presentation" class="el-breadcrumb__separator">/</span></span>
                <span class="el-breadcrumb__item" aria-current="page"><span role="link" class="el-breadcrumb__inner">
                        松滋市优化营商环境网上受理平台 </span><span role="presentation"
                        class="el-breadcrumb__separator">/</span></span>
            </div>
        </div>

        <div class="search-warp">
            <p>一、请您填写真实姓名、住址和联系方式，以便承办单位调查核实和反馈办理结果；</p>
            <p>二、请您简明扼要填写信件内容，写清事情发生的时间、地点、简要经过、需要解决的问题和诉求；</p>
            <p>三、请您客观真实反映情况和问题，对所反映内容的真实性负责，不得捏造歪曲事实，不得诬告、陷害他人。</p>
            <p>四、请填写主要事实、主要诉求、主要理由三部分。主要事实是指信访人反映的事物、事件、事态和情况。主要诉求是指信访人提出的权利请求或主张，是信访事项的核心内容。主要理由包括合法性理由与合理性理由。</p>
            <p style="text-align: center;margin-top: 30px;">
                <a href='./yshj_search/' target="_blank">
                    <button type="button" class="el-button el-button--primary">
                        <span>我要查询</span>
                    </button>
                </a>
            </p>
        </div>

        <form class="el-form" id="myForm">
            <div class="el-col el-col-24">
                <div class="el-form-item is-required">
                    <label for="rqstTitle" class="el-form-item__label"
                        style="width: 160px;display:flex;justify-content: flex-start;">诉求类型：</label>
                    <div class="el-form-item__content" style="margin-left: 160px">
                        <div class="el-col el-col-14">

                            <div style="display: flex;width: 300px;justify-content: space-around;">
                                <div>
                                    <input type="radio" id="appealType" name="appealType" value="1" checked />
                                    <label for="huey">咨询</label>
                                </div>

                                <div>
                                    <input type="radio" id="appealType" name="appealType" value="2" />
                                    <label for="huey">求助</label>
                                </div>

                                <div>
                                    <input type="radio" id="appealType" name="appealType" value="3" />
                                    <label for="huey">投诉</label>
                                </div>

                                <div>
                                    <input type="radio" id="appealType" name="appealType" value="4" />
                                    <label for="huey">建议</label>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="el-col el-col-24">
                <!-- <div class="el-form-item is-required"> -->
                <div class="el-form-item">
                    <label for="rqstContent" class="el-form-item__label"
                        style="width: 160px;display:flex;justify-content: flex-start;">诉求标题：</label>
                    <div class="el-form-item__content" style="margin-left: 160px">
                        <div class="el-col el-col-22">
                            <div class="el-input">
                                <input type="text" id="title" autocomplete="off" placeholder="请输入诉求标题"
                                    class="el-input__inner" />
                                <span class="el-input__suffix">
                                    <span class="el-input__suffix-inner">
                                        <span class="el-input__count"></span>
                                    </span>
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="el-col el-col-24">
                <div class="el-form-item">
                    <label for="rqstContent" class="el-form-item__label"
                        style="width: 160px;display:flex;justify-content: flex-start;">诉求目的：</label>
                    <div class="el-form-item__content" style="margin-left: 160px">
                        <div class="el-col el-col-22">
                            <div class="el-textarea">
                                <textarea id="purposeContent" name="purpose" autocomplete="off" rows="6" maxlength="299"
                                    placeholder="请输入诉求目的" class="el-textarea__inner"
                                    style="min-height: 33px"></textarea>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="el-col el-col-24">
                <div class="el-form-item is-required">
                    <label for="rqstContent" class="el-form-item__label"
                        style="width: 160px;display:flex;justify-content: flex-start;">诉求内容：</label>
                    <div class="el-form-item__content" style="margin-left: 160px">
                        <div class="el-col el-col-22">
                            <div class="el-textarea">
                                <textarea id="content" autocomplete="off" rows="5" maxlength="999"
                                    placeholder="请您一事一诉，尽量包含时间、地点、经过及主要诉求。" class="el-textarea__inner"
                                    style="min-height: 33px"></textarea>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="el-col el-col-24">
                <div class="el-form-item is-required">
                    <label for="rqstPerson" class="el-form-item__label"
                        style="width: 160px;display:flex;justify-content: flex-start;">具体地址：</label>
                    <div class="el-form-item__content" style="margin-left: 160px">

                        <div class="el-col el-col-7">
                            <div class="el-input">
                                <input type="text" id="specificAddress" autocomplete="off" maxlength="30"
                                    placeholder="请点击" class="el-input__inner" />
                                <span class="el-input__suffix">
                                    <span class="el-input__suffix-inner">
                                        <span class="el-input__count"></span>
                                    </span>
                                </span>
                            </div>
                        </div>

                        <div class="el-col el-col-7">
                            <div class="el-input" style="margin-left: 15px;">
                                <input type="text" id="extraAddress" name="extraAddress" autocomplete="off"
                                    maxlength="30" placeholder="请补充输入" class="el-input__inner" />
                                <span class="el-input__suffix">
                                    <span class="el-input__suffix-inner">
                                        <span class="el-input__count"></span>
                                    </span>
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- <div class="el-col el-col-24">
                <div class="el-form-item is-required">
                    <label for="rqstAddress" class="el-form-item__label"
                        style="width: 160px;display:flex;justify-content: flex-start;">诉求发生时间：</label>
                    <div class="el-form-item__content" style="margin-left: 160px">
                        <div class="el-col el-col-7">
                            <div style="border-radius: 4px;border: 1px solid #DCDFE6;">
                                <input type="datetime-local" step="1" id="occurrenceTime" value="">
                            </div>
                        </div>
                    </div>
                </div>
            </div> -->

            <div class="el-col el-col-24">
                <div class="el-form-item is-required">
                    <label for="linkNumber" class="el-form-item__label"
                        style="width: 160px;display:flex;justify-content: flex-start;">服务对象：</label>
                    <div class="el-form-item__content" style="margin-left: 160px">
                        <div class="el-col el-col-7">
                            <div class="el-input">
                                <input type="text" id="serviceTarget" autocomplete="off" placeholder="请输入"
                                    class="el-input__inner" />
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="el-col el-col-24">
                <div class="el-form-item is-required">
                    <label for="linkNumber" class="el-form-item__label"
                        style="width: 160px;display:flex;justify-content: flex-start;">性别：</label>
                    <div class="el-form-item__content" style="margin-left: 160px">
                        <div class="el-col el-col-14">

                            <div style="display: flex;width: 100px;justify-content: space-between;">
                                <div>
                                    <input type="radio" id="gender" name="gender" value="1" checked />
                                    <label for="huey">男</label>
                                </div>

                                <div>
                                    <input type="radio" id="gender" name="gender" value="2" />
                                    <label for="huey">女</label>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="el-col el-col-24">
                <div class="el-form-item is-required">
                    <label for="phoneNumber" class="el-form-item__label"
                        style="width: 160px;display:flex;justify-content: flex-start;">联系电话：</label>
                    <div class="el-form-item__content" style="margin-left: 160px">
                        <div class="el-col el-col-7">

                            <div class="el-input">
                                <input type="text" id="phoneNumber" autocomplete="off" maxlength="16"
                                    placeholder="仅工作人员有权查看" class="el-input__inner" style="width: 245px;" />
                                <span class="el-input__suffix"><span class="el-input__suffix-inner">
                                        <span class="el-input__count">
                                            <!-- <span class="el-input__count-inner"> 0/16</span> -->
                                        </span></span>
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="el-col el-col-24">
                <div class="el-form-item is-required">
                    <label for="linkNumber" class="el-form-item__label"
                        style="width: 160px;display:flex;justify-content: flex-start;">短信验证码：</label>
                    <div class="el-form-item__content" style="margin-left: 160px">
                        <div class="el-col el-col-7">
                            <div class="el-input">
                                <input type="text" id="captcha" autocomplete="off" placeholder="填写短信验证码"
                                    class="el-input__inner" />
                            </div>
                        </div>
                        <div class="el-col el-col-7" style="margin-left: 15px;">
                            <button type="button" id="getCaptcha" class="el-button el-button--primary">
                                <span>获取验证码</span>
                            </button>
                        </div>
                        <!-- <div class="el-col el-col-3"></div> -->
                    </div>
                </div>
            </div>

            <div class="el-col el-col-24">
                <div class="el-form-item">
                    <label class="el-form-item__label"
                        style="width: 160px;display:flex;justify-content: flex-start;">上传附件：</label>
                    <div class="el-form-item__content" style="margin-left: 160px">

                        <div class="upload">
                            <div class="el-upload el-upload--text" tabindex="0">
                                <button ariadisabled="false" type="button" id="file"
                                    class="el-button el-button--primary">
                                    <span class="">点击添加文件</span>
                                </button>

                                <input class="el-upload__input" id="imagePath" name="imagePath" accept="" type="file">
                            </div>
                            <ul class="el-upload-list el-upload-list--text"></ul>
                        </div>
                    </div>
                </div>
            </div>

            <div class="el-col el-col-24">

                <div class="el-form-item is-required asterisk-left el-form-item--feedback">
                    <div class="el-form-item__content" style="margin-left:160px;">
                        <div>
                            <input type="checkbox" id="anonymousOrNot" name="anonymousOrNot" />
                            <label for="scales">是否匿名</label>
                        </div>
                    </div>
                </div>

            </div>

            <!-- <div class="el-col el-col-24">
                <div class="el-form-item is-required asterisk-left el-form-item--feedback">
                    <div class="el-form-item__content" style="margin-left:160px;">
                        <div>
                            <input type="checkbox" id="needFollowUp" name="needFollowUp" />
                            <label for="scales">是否回访</label>
                        </div>
                    </div>
                </div>
            </div> -->

            <div class="el-col el-col-24" style="text-align: center; margin-top: 80px">
                <button id="submit" type="button" class="el-button el-button--primary">
                    <span>确认提交</span>
                </button>

            </div>
        </form>

        <div role="alert" class="el-notification right" style="top: 16px; z-index: 2012;display: none;">
            <img style="width: 24px;height: 24px;display: none;"
                src=""
                alt="" />
            <div class="el-notification__group is-with-icon">
                <h2 class="el-notification__title">提示</h2>
                <div class="el-notification__content">
                    <p>请输入联系电话！</p>
                </div>
                <div id="close" class="el-notification__closeBtn"> X </div>
            </div>
        </div>

        <!-- <button id="open-dialog-btn">打开对话框</button> -->

        <!-- 遮罩层 -->
        <div id="overlay" class="hidden"></div>

        <!-- 对话框 -->
        <div id="dialog" class="hidden">
            <div class="dialog-header">
                <h3>地址选择</h3>
                <button id="close-dialog-btn" class="close-button">&times;</button>
            </div>
            <div class="dialog-content" id="map-container">
                <!-- 这里是对话框内容。 -->
            </div>
            <div class="dialog-footer">

                <div style="color: #999;line-height: 38px;">选中位置</div>
                <div style="color: #333;line-height: 25px;"><span id="address"></span></div>

                <div style="display: flex;justify-content: flex-end;">
                    <button aria-disabled="false" type="button" class="el-button el-button--default" id="cancel-btn"
                        style="width: 80px;"><span class=""> 取 消 </span>
                    </button>
                    <button aria-disabled="false" type="button" class="el-button el-button--primary" id="confirm-btn"
                        style="width: 80px;"><span class=""> 确 定 </span>
                    </button>
                </div>

            </div>
        </div>


        <div id="dialog2" class="hidden">
            <div class="dialog-header">
                <h3>民意提交</h3>
                <button id="close-dialog-btn2" class="close-button">&times;</button>
            </div>
            <div class="dialog2-content" id="map-container">

                <div class="dg-img" style="text-align: center;">
                    <img src="./v2/mytjcg.png" alt="">
                </div>

                <div class="dg-context">
                    <div>
                        民意编号：
                        <span id="opinion-id"> </span>
                    </div>
                    <div>
                        查询密码：
                        <span id="opinion-password"> </span>
                    </div>
                </div>

                <div class="dg-tips">
                    注: 民意编号和查询密码用于查询民意的完成进度，
                    在网站首页民意查询界面输入即可查询详情进度。
                </div>

            </div>
            <div class="dialog-footer">

                <div style="display: flex;justify-content: center;">
                    <button aria-disabled="false" type="button" class="el-button el-button--primary" id="confirm-btn2"
                        style="width: 80px;"><span class=""> 已记住 </span>
                    </button>
                </div>

            </div>
        </div>


    </div>
    <script>

        let authToken = ''

        // 定时器
        let timer;

        // 其他视图相关效果
        // 打开提示框
        function message(msg, time) {
            time = time || 3000
            clearTimeout(timer);
            $(".el-notification__content p").text(msg);
            $(".el-notification").show();
            if (time == 60000) {
                $(".el-notification img").show();
            }
            timer = setTimeout(() => {
                $(".el-notification").hide();
                if (time == 60000) {
                    $(".el-notification img").hide();
                }
            }, time)
        }

        // 需上传字段
        let data = {
            channelId: 48,
            appealType: "",
            serviceTarget: "",
            phoneNumber: "",
            content: "",
            specificAddress: "",
            occurrenceTime: "",
            imagePath: "",
            anonymousOrNot: false,
            longitude: "",
            latitude: "",
            needFollowUp: false,
            title: "",
            purpose: "",
            gender: 1
        };

        $(function () {

            const specificAddressInput = document.getElementById('specificAddress');

            // 获取短信验证码
            function getCaptcha() {
                getViewData();
                let { phoneNumber } = data;
                let tel = phoneNumber;
                if (tel) {
                    if (/^1((3[\d])|(4[5,6,7,9])|(5[0-3,5-9])|(6[5-7])|(7[0-8])|(8[\d])|(9[1,8,9]))\d{8}$/.test(tel)) {
                        axios({
                            method: 'post',
                            url: 'http://minyisubanarmtest.gl-ns.com/api/public/msgcaptcha',
                            headers: { // 设置请求头
                                Token: authToken
                            },
                            data: {
                                PhoneNumbers: tel,
                                IsAuth: true,
                            }
                        }).then((res) => {
                            if (res) {
                                message('短信验证码已发送', 3000)
                                this.time = 60;
                                $('#getCaptcha').attr({ disabled: true });
                                this.timer = setInterval(() => {
                                    if (this.time > 0) {
                                        this.time--;
                                        $('#getCaptcha span').text(this.time);
                                    } else {
                                        clearInterval(this.timer);
                                        $('#getCaptcha').attr({ disabled: false });
                                        $('#getCaptcha span').text('获取验证码');
                                    }
                                }, 1000);
                            }
                        }).catch((e) => {
                            message("获取验证码失败！")
                        });
                    } else {
                        message("输入的联系电话有误！")
                    }
                } else {
                    message("请输入联系电话！")
                }

            }

            // 获取token
            function getToken() {
                axios.get('http://minyisubanarmtest.gl-ns.com/api/public/token').then(function (response) {
                    authToken = response.data
                });
            }
            getToken()

            let captcha = '';

            function openDialog2(callback) {
                document.getElementById('overlay').classList.remove('hidden');
                document.getElementById('dialog2').classList.remove('hidden');

                if (typeof callback === 'function') {
                    callback(); // 调用打开回调函数
                }
            }

            function closeDialog2(callback) {
                document.getElementById('overlay').classList.add('hidden');
                document.getElementById('dialog2').classList.add('hidden');

                if (typeof callback === 'function') {
                    callback(); // 调用关闭回调函数
                }
            }

            document.getElementById('confirm-btn2').addEventListener('click', function () {
                closeDialog2(function () {

                });
            });

            document.getElementById('close-dialog-btn2').addEventListener('click', function () {
                closeDialog2(function () {

                });
            });

            // 提交数据
            function submit() {

                getViewData();

                if (valid()) {


                    if (captcha) {

                        axios({
                            method: 'post',
                            url: 'http://minyisubanarmtest.gl-ns.com/api/public/phonelogin',
                            headers: { // 设置请求头
                                Token: authToken
                            },
                            data: {
                                phoneNumber: data.phoneNumber,
                                msgcaptcha: captcha
                            }
                        }).then((res) => {

                            message("民意提交中。。。")

                            let formData = new FormData();
                            for (let key in data) {
                                // 新增对 'purpose' 的检查
                                if (key === 'purpose') {
                                    if (data[key] !== undefined && data[key] !== null && data[key].trim() !== '') {
                                        formData.append(key, data[key]);
                                    }
                                } else if (key !== 'imagePath' && key !== 'specificAddress') {
                                    formData.append(key, data[key]);
                                }
                                if (key === 'specificAddress') {
                                    formData.append('specificAddress', data.specificAddress + data.extraAddress);
                                }
                                if (key === 'extraAddress') {
                                    formData.delete('extraAddress');
                                }
                            }

                            // 处理 fileList
                            if (fileList.length > 0) {
                                fileList.forEach((item) => {
                                    formData.append("imagePath", item);
                                });
                            }

                            axios({
                                method: 'post',
                                url: 'http://minyisubanarmtest.gl-ns.com/api/PublicOpinionQuickFixSystem/PublicOpinion',
                                headers: { // 设置请求头
                                    Token: authToken
                                },
                                data: formData
                            }).then(res => {
                                message("提交成功!");
                                // message((`工单编号：${res.data.publicOpinionCode}` + ` 查询密码：${res.data.queryPassword} ` + "，  请妥善保管！"), 60000);
                                openDialog2(function () {
                                    document.getElementById('opinion-id').textContent = res.data.publicOpinionCode
                                    document.getElementById('opinion-password').textContent = res.data.queryPassword
                                })
                            }).catch(err => {
                                message("提交失败!");
                            }).finally(() => {

                                data = {}
                                fileList = []
                                document.getElementById('myForm').reset();

                                // document.querySelector('#occurrenceTime').value = formatDate(new Date())

                                const uploadList = document.querySelector('.el-upload-list');
                                const childElements = uploadList.children;

                                while (childElements.length > 0) {
                                    uploadList.removeChild(childElements[0]);
                                }

                            })

                        }).catch(err => {
                            message("短信验证码错误!")
                        })
                    } else {
                        message("请填写短信验证码！");
                    }

                } else {
                    message("请输入完整信息！");
                    return false;
                }

            }

            // 字段验证
            function valid() {

                let flag = true;
                // const keysToExclude = ['imagePath', 'anonymousOrNot', 'needFollowUp', 'extraAddress', 'purpose'];

                const keysToExclude = ['imagePath', 'anonymousOrNot',  'extraAddress', 'purpose'];

                Object.keys(data).forEach((key) => {
                    if (!keysToExclude.includes(key) && data[key] === '') {
                        flag = false;
                    }
                });

                return flag;

            }
            // 关闭提示框
            function close() {
                clearTimeout(timer);
                $(".el-notification").hide();
            }

            // 解析日期字符串 输出固定格式
            function formatDate(dateString) {
                // 解析日期字符串
                const date = new Date(dateString);
                // 获取年份
                const year = date.getFullYear();
                // 获取月份（注意：月份是从0开始的，所以+1）
                const month = String(date.getMonth() + 1).padStart(2, '0');
                // 获取日期
                const day = String(date.getDate()).padStart(2, '0');
                // 获取小时和分钟、秒钟
                const hours = String(date.getHours()).padStart(2, '0');
                const minutes = String(date.getMinutes()).padStart(2, '0');
                const seconds = String(date.getSeconds()).padStart(2, '0');
                // 格式化日期字符串
                const formattedDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
                return formattedDate;
            }

            // document.querySelector('#occurrenceTime').value = formatDate(new Date())

            // 获取视图中的数据赋值给data
            function getViewData() {

                data.appealType = document.querySelector('input[name="appealType"]:checked').value

                data.title = document.querySelector('#title').value

                data.content = document.querySelector('#content').value

                data.specificAddress = document.querySelector('#specificAddress').value

                data.extraAddress = document.querySelector('#extraAddress').value

                // data.occurrenceTime = formatDate(document.querySelector('#occurrenceTime').value)

                data.occurrenceTime = formatDate(new Date())

                data.serviceTarget = document.querySelector('#serviceTarget').value

                data.phoneNumber = document.querySelector('#phoneNumber').value

                captcha = document.querySelector('#captcha').value

                const anonymousOrNot = document.getElementById('anonymousOrNot');

                const needFollowUp = document.getElementById('needFollowUp');

                if (anonymousOrNot.checked) {
                    data.anonymousOrNot = true
                } else {
                    data.anonymousOrNot = false
                }

                // if (needFollowUp.checked) {
                //     data.needFollowUp = true
                // } else {
                //     data.needFollowUp = false
                // }

                data.purpose = document.querySelector('#purposeContent').value;

                data.gender = document.querySelector('input[name="gender"]:checked').value
            }

            var fileList = [];
            console.log('fileList', fileList);

            const fileButton = document.getElementById('file');
            const fileInput = document.querySelector("input[type='file']");

            fileButton.addEventListener('click', function () {
                fileInput.click();
            });

            fileInput.addEventListener('change', function (e) {
                let files = this.files;
                for (let i = 0; i < files.length; i++) {
                    fileList.push(files[i]);
                    let fileName = files[i].name;

                    // 创建 li 元素并添加到上传列表中
                    const li = document.createElement('li');
                    li.className = 'el-upload-list__item is-ready';
                    li.innerHTML = '<a class="el-upload-list__item-name">' + fileName + '</a> <i class="el-icon-close" style="font-family:monospace !important">X</i>';

                    // 将 li 元素添加到上传列表中
                    document.querySelector('.el-upload-list').appendChild(li);
                }

                fileInput.value = ''
            })

            const uploadList = document.querySelector('.el-upload-list');
            uploadList.addEventListener('click', function (e) {
                if (e.target.tagName === 'I') {
                    let index = Array.from(e.target.parentNode.parentNode.children).indexOf(e.target.parentNode);
                    e.target.parentNode.remove();
                    fileList.splice(index, 1);

                    fileInput.value = ''
                }
            });

            // 提交
            $("#submit").click(submit);
            // 获取验证码按钮
            $("#getCaptcha").click(getCaptcha);

            $("label[role='radio']").click(function () {
                $(this).addClass("is-checked");
                $(this).children('span').eq(0).addClass("is-checked");
                let field = $(this).data('field');
                data[field] = $(this).find('input').val();

                $(this).siblings().eq(0).removeClass("is-checked");
                $(this).siblings().eq(0).children('span').eq(0).removeClass("is-checked");
            });
        });
    </script>

    <script>

        window.onload = function () {
            const script = document.createElement('script');
            script.src = 'https://map.qq.com/api/gljs?v=1.exp&key=F42BZ-DPU6Z-C3RXT-7BXTY-IMF7J-2MBFT';
            document.head.appendChild(script);
        }

        // 具体地址
        const specificAddressInput = document.getElementById('specificAddress')

        specificAddressInput.readOnly = true

        let center = null;

        let markerLayer = null;

        let validAddress = ''

        let locationS = {}

        let latLng

        function getBDAddress(lat, lng) {
            return axios({
                method: 'get',
                url: 'http://minyisubanarmtest.gl-ns.com/api/PublicOpinionQuickFixSystem/public/PublicOpinion/webServiceGuide/address/gcoder',
                headers: { // 设置请求头
                    Token: authToken
                },
                params: {
                    lat,
                    lng
                }
            })
        }

        const addressSpan = document.getElementById('address');
        addressSpan.textContent = '请点击地图选择您的地址';

        function openDialog(callback) {
            document.getElementById('overlay').classList.remove('hidden');
            document.getElementById('dialog').classList.remove('hidden');

            if (typeof callback === 'function') {
                callback(); // 调用打开回调函数
            }
        }

        function closeDialog(callback) {
            document.getElementById('overlay').classList.add('hidden');
            document.getElementById('dialog').classList.add('hidden');

            if (typeof callback === 'function') {
                callback(); // 调用关闭回调函数
            }
        }

        specificAddressInput.addEventListener('focus', function () {

            document.getElementById('specificAddress').addEventListener('click', function () {

                openDialog(function () {
                    // console.log('对话框已打开'); // 示例打开回调操作
                    // 可在此处添加实际的打开回调逻辑

                    if (center) return;

                    center = new TMap.LatLng(30.174707, 111.756477);
                    var map = new TMap.Map('map-container', {
                        zoom: 16, //设置地图缩放级别
                        center: center, //设置地图中心点坐标
                    });

                    map.setViewMode('2D');

                    map.on('click', async (evt) => {
                        console.log(evt);
                        // console.log(evt.latLng, evt.poi?.name);

                        if (markerLayer) {
                            markerLayer.setMap(null);
                        }

                        markerLayer = new TMap.MultiMarker({
                            map: map,
                        });

                        markerLayer.add({
                            position: evt.latLng,
                        });
                        latLng = evt.latLng;

                        const response = await getBDAddress(
                            evt.latLng.lat,
                            evt.latLng.lng
                        );

                        if (!response) {
                            message("获取位置信息失败");
                        }

                        const addressSpan = document.getElementById('address');
                        addressSpan.textContent = response.data?.result?.formatted_addresses?.recommend || '未匹配到地址名称';

                        validAddress = response.data?.result?.formatted_addresses?.recommend || null

                        locationS = {

                            longitude: response.data.result.location.lng,
                            latitude: response.data.result.location.lat

                        }

                    });

                });

            });

        });

        document.getElementById('close-dialog-btn').addEventListener('click', function () {
            closeDialog(function () {
                // console.log('对话框已关闭'); // 示例关闭回调操作
                // 可在此处添加实际的关闭回调逻辑
            });
        });

        document.getElementById('cancel-btn').addEventListener('click', function () {
            closeDialog(function () {
                // console.log('对话框已关闭'); // 示例关闭回调操作
                // 可在此处添加实际的关闭回调逻辑
                if (markerLayer) markerLayer.setMap(null);
                validAddress = ''
                latLng = ''
                addressSpan.textContent = '请点击地图选择您的地址'
            });
        });

        document.getElementById('confirm-btn').addEventListener('click', function () {
            closeDialog(function () {
                // console.log('对话框已关闭'); // 示例关闭回调操作
                // 可在此处添加实际的关闭回调逻辑

                document.querySelector('#specificAddress').value = validAddress

                data.longitude = locationS.longitude
                data.latitude = locationS.latitude

            });
        });
    </script>


    <style>
        /* 遮罩层样式 */
        #overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 99;
        }

        /* 对话框样式 */
        #dialog {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background-color: #fff;
            border-radius: 5px;
            padding: 20px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
            z-index: 100;
            /* width: 400px; */
            width: 1200px;
        }

        .dialog-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .dialog-header h3 {
            margin: 0;
        }

        .close-button {
            background: none;
            border: none;
            font-size: 20px;
            cursor: pointer;
        }

        .dialog-content {
            margin-top: 10px;
        }

        .dialog-footer {
            display: flex;
            justify-content: flex-end;
            margin-top: 10px;

            flex-direction: column;
        }

        /* 初始隐藏遮罩层和对话框 */
        .hidden {
            display: none;
        }

        #dialog2 {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background-color: #fff;
            border-radius: 5px;
            padding: 20px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
            z-index: 100;
            /* width: 400px; */
            width: 600px;
        }


        .dialog2-content {
            margin-top: 10px;
            margin-bottom: 30px;
        }

        .dg-context {
            font-size: 16px;
            color: #999999;
            padding: 25px 155px 0;
            line-height: 36px;
        }

        .dg-context span {
            color: #333333;
        }

        .dg-tips {
            color: #2073ed;
            font-size: 16px;
            padding: 20px 78px 0 78px;
            line-height: 36px;
            text-indent: 36px;
        }
    </style>

    <TRS_TEMPLATE TEMPNAME="新版_footer"></TRS_TEMPLATE>
</body>

</html>